home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 2002 January / PC Answers January 2002.7z / PC Answers January 2002.bin / graphics / freepixl / _SETUP.1 / Ifendif.pxl < prev    next >
Text File  |  2000-12-23  |  2KB  |  104 lines

  1. Initialize:
  2.     WinGetActive(Win$)
  3.     UseCoordinates(PIXEL)
  4.     UseBackGround(OPAQUE,192,192,192)
  5.     DrawBackGround
  6.     WaitInput(100)  {let NT and 95 catch up}
  7.     InfoMenu(REMOVE)
  8.     SetMenu()
  9.     WinLocate(Win$,100,100,480,300,Res)
  10.     Title$ = "Embedded If-Else-Endif"
  11.     WinTitle(Win$, Title$)
  12.  
  13.  
  14.  
  15.     SetMenu("Exit!",Leave,
  16.         ENDPOPUP,
  17.         "Embed If Testing",EmbeddedIfThen,
  18.         ENDPOPUP,
  19.         "Multitest Loop",MultiTest,
  20.         ENDPOPUP)
  21.     
  22.  
  23.     Number1 = 0
  24.     Number2 = 0
  25.     Levels = 0
  26.     
  27.  
  28. Wait_for_Input:
  29.     WaitInput()
  30.  
  31.  
  32. Leave:
  33.     End
  34.  
  35.  
  36. EmbeddedIfThen:
  37.     GoSub IfThenTest
  38.     Goto Wait_for_Input
  39.  
  40.  
  41. MultiTest:
  42.     DrawBackGround
  43.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  44.     DrawIcon(1,1,0,0,INFORMATION)
  45.     DrawTextExt(40,cy1,cx2,cy2,
  46. "This function tests 'If-Then' commands embedded in an 'If-Else-Endif' construction. The process iterates 50 times. Change it if you want !",LEFT)
  47.     WaitInput(2500)
  48.     DrawBackground
  49.     Test = 0
  50. TestLoop:
  51.     GoSub IfThenTest
  52.     Test++
  53.     WaitInput(1)
  54.     If Test < 50 Then Goto TestLoop
  55.  
  56.     Goto Wait_for_Input
  57.  
  58.  
  59. IfThenTest: {=== subroutine ===}
  60.     DrawBackground
  61.     Levels++ 
  62.     DrawNumber(150,30,Levels)
  63.     If Number1 = 0
  64.         { here's a comment with an endif }
  65.         DrawIcon(1,1,0,0,ICON01)
  66.         If Number2 = 0 Then DrawIcon(80,1,0,0,ICON03)
  67.             WaitInput(1)
  68.         Number2++
  69.         If Number2 = 2 Then Number1 = 1
  70.         If Number2 = 4 Then Number2 = 0
  71.         
  72.         {here's an embedded If-Endif}
  73.     
  74.         If Number1 = 0
  75.         DrawIcon(1,1,0,0,ICON07)
  76.         If Number = 1
  77.             DrawIcon(10,10,0,0,ICON10)
  78.             If Number = 1
  79.                 DrawIcon(20,20,0,0,ICON10)
  80.             If Number =1 Then DrawIcon(10,10,60,60,ICON13)
  81.             Endif
  82.         Endif
  83.         Else
  84.            DrawIcon(1,1,0,0,ICON08)
  85.         Endif
  86.     
  87.     Else
  88.         DrawIcon(1,1,0,0,ICON04)
  89.         If Number2 = 1 Then DrawIcon(80,1,0,0,ICON06)
  90.         If Number2 = 2 Then Number1 = 0
  91.         Number2++
  92.  
  93.         If Number1 = 1
  94.         DrawIcon(1,10,0,0,ICON09)
  95.         Number = 0
  96.         Else
  97.            DrawIcon(1,10,0,0,ICON10)        
  98.          Number = 1
  99.         Endif
  100.         
  101.  
  102.     Endif
  103.     Return
  104.